<template>
  <div class="">
    <van-nav-bar
      title="城市列表"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 城市列表 -->
    <van-index-anchor index="当前城市" />
    <h3>上海</h3>
    <van-index-bar v-for="item in cityList" :key="item.id">
      <p>{{ item.label }}</p>
    </van-index-bar>
  </div>
</template>
<script>
import { city } from '@/api/my'
export default {
  name: 'City',
  props: {},
  components: {},
  data () {
    return {
      cityList: []
    }
  },
  async created () {
    const res = await city()
    // console.log(res)
    this.cityList = res.body
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    }
  }
}
</script>
<style lang="less" scoped>
.city {
  font-size: 16px !important;
}
p,
h3 {
  font-size: 18px;
  margin-left: 15px;
}
</style>
